import React from 'react';
import '../../../static/css/pc/it_title.less';

export default class IT extends React.Component{
	constructor(){
		super();
		this.state={
			it_title:[]
		}
	}
	componentDidMount(){
		var result=fetch(this.props.url,{
			method:'get'
		})
		.then(res => {
			return res.json()
		})
		.then(json => {
			console.log(json)
			this.setState({
				it_title:json
			})
		})
	}
	render(){
		var {it_title}=this.state;
		return(
			<div className="it_title">
				<ul>
					{
						it_title.map((item,index) => {
							return (
								<li key={index} style={this.props.ittStyle}>
									<p className='category'>{item.category}图片</p>
									<a href={item.url}>
										<img src={item.thumbnail_pic_s} alt=""/>
										<p className='title'>{item.title}</p>
									</a>
								</li>
							)
						})	
					}
				</ul>
			</div>
		)
	}
}
